@extends('common.company_template')

@section('content')
    <div class="boxWidth">
        @include('common.notice_msg')
        <div class="row searchLine">
            <div class="col-xs-6">
                <input type="text" placeholder="请输入订单号" id="searchInput">
                <button class="btn btn-default searchBtn" id="searchCon">搜索</button>
            </div>
            <div class="col-xs-6">
            </div>
        </div>
        <table class="table table-hover adminTableBg">
            <thead>
            <tr>
                <th class="col-xs-2">订单号</th>
                <th class="col-xs-3">订单内容</th>
                <th class="col-xs-1">价格</th>
                <th class="col-xs-1">购买者</th>
                <th class="col-xs-1">状态</th>
                <th class="col-xs-1">配送</th>
                <th class="col-xs-2">时间</th>
                <th class="col-xs-1">操作</th>
            </tr>
            </thead>
            <tbody>
            <?php $metaName = ['未','已'];$statusName = ['未付款','已付款','已取消']; ?>
            @foreach($Orders as $g)
                <tr>
                    <th class="col-xs-2 itemTd">{{$g->trade}}</th>
                    <th class="col-xs-3 itemTd">{{$g->body}}</th>
                    <th class="col-xs-1 itemTd">{{$g->total}}</th>
                    <th class="col-xs-1 itemTd">{{$g->user}}</th>
                    <th class="col-xs-1 itemTd">{{$statusName[$g->status]}}</th>
                    <th class="col-xs-1 itemTd">{{$metaName[$g->meta]}}配送</th>
                    <th class="col-xs-2 itemTd">{{$g->created_at}}</th>
                    <th class="col-xs-1 itemTd">
                        <a href="{{url('shop/orders',['id' => $g->id])}}"><span >查看</span></a>
                    </th>
                </tr>
            @endforeach
            </tbody>
        </table>
        <div class="pull-right">
            <?php
            $s=isset($_GET['s'])?$_GET['s']:'';
            if($s){
                $url = ['s' => $s];
            }else{
                $url = [];
            }
            ?>
            {!! $Orders->appends($url)->render() !!}
        </div>
    </div>
@stop
@section('js')
    <script>
        (function () {
            $('#searchCon').on('click',function () {
                var url = $('#searchInput').val().replace(/(^\s*)|(\s*$)/g, "");
                if(url){
                    window.location.href= "{!! url('shop?s=') !!}"+url;
                }else{
                    window.location.href= "{!! url('shop') !!}"
                }
            });
        })()
    </script>
@stop